//
//  RedPacketController.m
//  cooba-iOS
//
//  Created by 郭四虎 on 16/9/8.
//  Copyright © 2016年 YouKu. All rights reserved.
//

#import "RedPacketController.h"

@interface RedPacketController ()
@property (weak, nonatomic) IBOutlet UIImageView *adIma;
@property (weak, nonatomic) IBOutlet UIImageView *logoIma;
@property (weak, nonatomic) IBOutlet UILabel *comName;
@property (weak, nonatomic) IBOutlet UILabel *money;
@property (weak, nonatomic) IBOutlet UILabel *show;

@end

@implementation RedPacketController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UILabel *la = [[UILabel alloc]initWithFrame:CGRectMake(_adIma.width*SCALEX-50, _adIma.height*SCALEX -40, 100, 30)];
    font(la, 12);
    la.textColor = [UIColor whiteColor];
    la.text = @"查看详情";
    [_adIma addSubview:la];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(showDetail)];
    [_adIma addGestureRecognizer:tap];
    
    [_adIma sd_setImageWithURL:[NSURL URLWithString:_rp.pic] placeholderImage:[UIImage imageNamed:@"酷吧LOGO_meitu_1"]];
    [_logoIma sd_setImageWithURL:[NSURL URLWithString:_rp.photo] placeholderImage:[UIImage imageNamed:@"酷吧LOGO_meitu_1"]];
    if (_rp.dbMoney.integerValue) {
        _money.text = [NSString stringWithFormat:@"%@元",_rp.dbMoney];
        _comName.text = [NSString stringWithFormat:@"%@ 给你一个红包",_rp.name];
    }else{
        _money.text = _rp.msg;
        _comName.hidden = YES;
        _show.hidden = YES;
    }
    
}

- (void)showDetail
{
    [self dismissViewControllerAnimated:NO completion:^{
        self.back();
    }];
    
}
- (IBAction)close:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
